package com.qfedu.edu.classservice.controller;


import com.qfedu.edu.classservice.service.ClassService;
import com.qfedu.edu.result.R;
import com.qfedu.edu.vo.AddClassVo;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2024-11-06
 */
@RestController
@RequestMapping("/classservice/class")
public class ClassController {

    @Autowired
    private ClassService classService;

    /**
     * 添加秒杀课程
     * @param addClassVo
     * @return
     */
    @PostMapping("/addClassVo")
    public R addClass(AddClassVo addClassVo, @RequestParam("file") MultipartFile file) throws IOException, InvocationTargetException, IllegalAccessException, TemplateException {
        classService.addClass(addClassVo,file);
        return R.ok();
    }

}

